package io.xccit.test;

import io.xccit.pojo.Person;
import io.xccit.pojo.Student;
import io.xccit.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Xccit
 * @Date 2023-01-16
 * @Description 测试DI
 */
public class ApplicationTest2 {
    @Test
    public void fun1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) context.getBean("user1");
        System.out.println(user);
    }
    @Test
    public void fun2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) context.getBean("user2");
        System.out.println(user);
    }
    @Test
    public void fun3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student student = (Student) context.getBean("student");
        System.out.println(student);
    }
    @Test
    public void fun4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Student student = (Student) context.getBean("student1");
        System.out.println(student);
    }
}
